home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Shareware Grab Bag
/
Shareware Grab Bag.iso
/
050
/
madtrb1.arc
/
FILE.INC
< prev
next >
Wrap
Text File
|
1986-03-13
|
33KB
|
725 lines
{ FILE.INC }
{ *************************************************************************** }
{ * * }
{ * TURBO SCREEN INPUT PRE-PROCESSOR TOOLKIT * }
{ * * }
{ * FILE CONTROL SUBPROGRAM INCLUDE FILE * }
{ * * }
{ * Version 1.07 * }
{ * * }
{ * * }
{ * This subprogram contains five modules. Two modules are used simply * }
{ * to prompt the user with a file request window. Two other modules * }
{ * use the previous modules when prompting the user when reading and * }
{ * writing data input files. The last module generates a directory * }
{ * listing of data input files. Note that there are some global * }
{ * functions and procedures contained within this library which are * }
{ * shared by these modules. * }
{ * * }
{ * Note that the modules within this include file have been written * }
{ * specifically for the example application of the input pre-processor. * }
{ * You may want to rewrite these modules for your application. * }
{ * * }
{ *************************************************************************** }
Procedure RemoveNewFileLabel;
{ This procedure removes the NEW FILE label for the input data file name that
the user has entered. }
Begin { RemoveNewFileLabel }
TextBackground(BackgroundColor);
Window(1,1,80,25);
GotoXY(60,3);
Write(' ');
NewFile:=False;
End; { RemoveNewFileLabel }
Procedure LabelNewFile;
{ This procedure describes the input data filename that the user has inputed as
a NEW FILE. }
Begin { LabelNewFile }
TextColor(ForegroundColor);
TextBackground(BackgroundColor);
Window(1,1,80,25);
GotoXY(60,3);
Write('NEW FILE');
NewFile:=True;
End; { LabelNewFile }
Procedure RemoveWindow;
{ This procedure removes the file message window which was overlayed onto the
current input page. }
Begin { RemoveWindow }
Window(1,1,80,25);
RecallTextScreen(1);
End; { RemoveWindow }
Procedure ShowFileWindowModule;
{ *************************************************************************** }
{ * * }
{ * SHOW FILE MESSAGE WINDOW MODULE * }
{ * * }
{ * This module controls the overlaying of a input data file window * }
{ * onto the current screen. This window is used to prompt the user * }
{ * what to do with input data files. * }
{ * * }
{ *************************************************************************** }
Var
TextString:WorkString; { a string used in passing text to other procedures }
Procedure ShowInputPrompt( InputPrompt,
PromptColor,
PromptBackground,
InputBlockColor,
InputBlockBackground:Integer);
{ This procedure is used to display the file name and disk drive specifier
prompt onto the file control window. }
Var
ScreenCol:Integer; { column index counter used in displaying empty input data entry }
Begin { ShowInputPrompt }
With G_I_Pages[1].Template[InputPrompt]^ Do { observe the 1 as the G_I_Page, specific to example application }
Begin
TextColor(PromptColor);
TextBackground(PromptBackground);
GotoXY(InputCol,InputRow);
For ScreenCol:=1 To InputLength Do
Write(' ');
GotoXY(PromptCol,PromptRow);
Write(Prompt);
TextColor(InputBlockColor);
TextBackground(InputBlockBackground);
GotoXY(InputCol,InputRow);
If Length(G_I_Data[InputPrompt,1]^)=0 Then { observe the 1 as the G_I_Page, specific to example application }
For ScreenCol:=1 To InputLength Do
Write(' ')
Else
Write(G_I_Data[InputPrompt,1]^); { observe the 1 as the G_I_Page, specific to example application }
End; { With G_I_Pages }
End; { ShowInputPrompt }
Begin { ShowFileWindowModule }
StoreTextScreen(1); { take a snapshot of the screen }
TextColor(InputWindowBorderColor);
TextBackground(InputWindowColor);
ZoomWindow2(4,2,77,10);
TextColor(ForegroundColor);
TextString:='Make selection with '+Chr(27)+' '+Chr(26)+' and then press <Enter>';
WriteCenterText(10,TextString);
{ write out input data file name }
ShowInputPrompt(1,
ForegroundColor,
InputWindowColor,
ForegroundColor,
InputWindowColor);
{ write out disk drive specifier path }
ShowInputPrompt(2,
ForegroundColor,
InputWindowColor,
ForegroundColor,
InputWindowColor);
End; { ShowFileWindowModule }
Function ExistantFile:Boolean;
{ This function determines if the input data file the user has named exists
under the specified disk directory path. If the file exists, this function
returns to the calling routine as true. }
Var
InputDataFile:Text; { input data file is a ASCII text file }
Begin { ExistantFile }
{ following routine is specific to the example application of the input pre-processor }
If G_I_Data[2,1]^='' Then { user has not specified a directory path }
Assign(InputDataFile,G_I_Data[1,1]^+INPUT_FILE_NAME_EXTENSION) { assign disk file }
Else { user has specified a directory path }
Assign(InputDataFile,G_I_Data[2,1]^+'\'+G_I_Data[1,1]^+INPUT_FILE_NAME_EXTENSION); { assign disk file }
{$I-} { I/O error checking is set to passive state }
Reset(InputDataFile); { open file for reading }
{$I+} { I/O error checking is set to active state }
If IOresult=0 Then { If IOresult=0, then file exists }
Begin { input data file exists }
Close(InputDataFile); { make certain to close file after checking if file exists }
ExistantFile:=True; { function returns as true }
End { If IOresult }
Else { input data file does not exist }
ExistantFile:=False; { function returns as false }
End; { ExistantFile }
Procedure PromptUserModule(Var ToggleSwitchOn:Boolean);
{ *************************************************************************** }
{ * * }
{ * PROMPT USER MODULE * }
{ * * }
{ * This module prompts the user for a command by controlling a * }
{ * visible toggle switch. The user selects either 'YES' or 'NO' * }
{ * and then presses return to communicate his instruction. * }
{ * This module then returns to the calling routine what the user's * }
{ * selection was. * }
{ * * }
{ *************************************************************************** }
Var
CharEntry:Char; { a variable used in reading the keyboard }
Procedure ShowToggleSwitch( ToggleSwitchOn:Boolean);
{ This procedure locates and prints on the screen whether the toggle switch
has been set to 'YES' or 'NO'. }
Begin { ShowToggleSwitch }
GotoXY(37,8);
If ToggleSwitchOn Then { toggle switch set to 'YES' }
Begin
TextColor(HighlightColor);
Write('YES ');
TextColor(ForegroundColor);
Write('/ NO');
End { If ToggleSwitchOn }
Else { toggle switch set to 'NO' }
Begin
TextColor(ForegroundColor);
Write('YES /');
TextColor(HighlightColor);
Write(' NO');
End; { Else }
End; { ShowToggleSwitch }
Procedure CurseLeft(Var ToggleSwitchOn:Boolean);
{ This procedure controls the cursor's leftward movement. Note that cursing
to the left or typing 'Y' or 'y' turns on the toggle switch. Also note
that if the switch is already on then an error is sounded. }
Begin { CurseLeft }
If Not(ToggleSwitchOn) Then
Begin
ToggleSwitchOn:=True;
ShowToggleSwitch(ToggleSwitchOn);
End { If Not(ToggleSwitchOn) }
Else { illegal entry }
SoundError;
End; { CurseLeft }
Procedure CurseRight(Var ToggleSwitchOn:Boolean);
{ This procedure controls the cursor's rightward movement. Note that cursing
to the right or typing 'N' or 'n' turns off the toggle switch. Also note
that if the switch is already off then an error is sounded. }
Begin { CurseRight }
If ToggleSwitchOn Then
Begin
ToggleSwitchOn:=False;
ShowToggleSwitch(ToggleSwitchOn);
End { If ToggleSwitchOn }
Else { illegal entry }
SoundError;
End; { CurseRight }
Begin { PromptUserModule }
ToggleSwitchOn:=False; { initialize toggle switch to off }
ShowToggleSwitch(ToggleSwitchOn); { display toggle switch }
Repeat
Read(Kbd,CharEntry);
If(CharEntry=Chr(27)) And Keypressed Then { read a character, check for a double character entry. }
Begin { double character entry }
Read(Kbd,CharEntry);
Case Ord(CharEntry) Of
75 : CurseLeft(ToggleSwitchOn); { CurseLeft }
77 : CurseRight(ToggleSwitchOn); { CurseRight }
Else { illegal entry }
SoundError;
End; { Case }
End { If CharEntry }
Else { single character entry }
If CharEntry<>Chr(13) Then
Case CharEntry Of
'Y' : CurseLeft(ToggleSwitchOn); { Character Y }
'y' : CurseLeft(ToggleSwitchOn); { Character y }
'N' : CurseRight(ToggleSwitchOn); { Character N }
'n' : CurseRight(ToggleSwitchOn); { Character n }
Else { illegal entry }
SoundError;
End; { Case CharEntry }
Until CharEntry=Chr(13); { until received carriage return }
End; { PromptUserModule }
Procedure ReadInputFileModule;
{ *************************************************************************** }
{ * * }
{ * READ INPUT DATA FILE MODULE * }
{ * * }
{ * This module controls all of the input data file handling * }
{ * routines for retrieving data off of disk storage. In addition, * }
{ * it prompts the user for input file handling commands. * }
{ * * }
{ *************************************************************************** }
Var
ReadInputFile:Boolean; { a boolean used to determine if the user wants the input data file to be read }
Procedure ReadInputDataFile;
{ This procedure reads the entries out of the user's declared input data
work file and stores the entries into both the G_I_Data and S_I_Data
data pointer arrays. }
Var
InputDataFile:Text; { input data file is a ASCII text file }
Page:Integer; { a index counter to a data page }
Row:Integer; { a index counter to a data row }
Col:Integer; { a index counter to a data column }
Begin { ReadInputDataFile }
{ following routine is specific to the example application of the input pre-processor }
If G_I_Data[2,1]^='' Then { user has not specified a directory path }
Assign(InputDataFile,G_I_Data[1,1]^+INPUT_FILE_NAME_EXTENSION) { assign disk file }
Else { user has specified a directory path }
Assign(InputDataFile,G_I_Data[2,1]^+'\'+G_I_Data[1,1]^+INPUT_FILE_NAME_EXTENSION);
Reset(InputDataFile); { open input data file for reading }
{$I-} { I/O error checking is set to passive state }
For Page:=1 To MAX_NUM_OF_G_I_PAGES Do { # of general input pages }
For Row:=1 To G_I_RECORD_LIMIT Do { # of general input rows }
If G_I_Data[Row,Page]<>Nil Then { check for corresponding prompt entry in template }
If Not ((Page=1) And (Row<=2)) Then { specific to example application of the input pre-processor }
ReadLn(InputDataFile,G_I_Data[Row,Page]^); { read entry out of file }
For Page:=1 To MAX_NUM_OF_S_I_PAGES Do { # of scrolling input pages }
For Row:=1 To S_I_ENTRY_LIMIT Do { # of scrolling input rows }
For Col:=1 To MAX_NUM_OF_S_I_DATA_COLS Do { # of scrolling input columns }
ReadLn(InputDataFile,S_I_Data[Col,Row,Page]^); { read scrolling input entry out of file }
Close(InputDataFile); { close input data file }
{$I+} { I/O error checking is set to active state }
End; { ReadInputDataFile }
Procedure ShowReadFileWindow( ReadInputFile:Boolean);
{ This procedure prompts the user for file reading handling information. }
Begin { ShowReadFileWindow }
If Not(ReadInputFile) Then { show first file handling prompt }
Begin
ShowFileWindowModule;
GotoXY(15,6);
TextColor(HighlightColor);
Write('Do you wish the above disk file to be read into memory?');
End { If Not(ReadInputFile) }
Else { show second file handling prompt }
Begin
TextColor(HighlightColor);
GotoXY(15,6);
Write(' ');
GotoXY(37,8);
Write(' ');
GotoXY(30,6);
Write('Input file being read');
End; { Else }
End; { ShowReadFileWindow }
Begin { ReadInputFileModule }
{ following routine is specific to example application of the input pre-processor }
If G_I_Data[1,1]^<>'' Then { check for a user entered filename }
If ExistantFile Then
Begin { input file is existant }
SoundAttention;
ShowReadFileWindow(ReadInputFile);
PromptUserModule(ReadInputFile);
If ReadInputFile Then
Begin { read file }
SoundAttention;
ShowReadFileWindow(ReadInputFile);
ReadInputDataFile;
RemoveWindow;
Write_G_I_Entries;
RemoveNewFileLabel; { do not declare file name as a new file }
End { If ReadInputFile }
Else { Not ReadInputFile }
Begin
RemoveWindow;
LabelNewFile { declare file name as a new file }
End; { Else }
End { If ExistantFile }
Else { user declared input file is non-existant }
LabelNewFile
Else { no user declared input file }
RemoveNewFileLabel;
End; { ReadInputFileModule }
Procedure WriteInputFileModule;{(Var ReturnToMainModule:Boolean);}
{ *************************************************************************** }
{ * * }
{ * WRITE INPUT DATA FILE MODULE * }
{ * * }
{ * This module controls all of the input data file handling * }
{ * routines for storing data on disk. In addition, the module * }
{ * prompts the user for input file handling commands. * }
{ * * }
{ *************************************************************************** }
Var
ToggleSwitchOn:Boolean; { a boolean used to determine the user's selection }
Procedure WriteInputDataFile;
{ This procedure takes the entries from both the G_I_Data and S_I_Data
data pointer arrays and writes them into the user's declared input data
work file. }
Var
InputDataFile:Text; { input data file is a ASCII text file }
Page:Integer; { a index counter to a data page }
Row:Integer; { a index counter to a data row }
Col:Integer; { a index counter to a data column }
Begin { WriteInputDataFile }
{ following routine is specific to example application of the input pre-processor }
If G_I_Data[2,1]^='' Then { user has not specified a directory path }
Assign(InputDataFile,G_I_Data[1,1]^+INPUT_FILE_NAME_EXTENSION) { assign disk file }
Else { user has specified a directory path }
Assign(InputDataFile,G_I_Data[2,1]^+'\'+G_I_Data[1,1]^+INPUT_FILE_NAME_EXTENSION);
Rewrite(InputDataFile); { open input data file for writing }
For Page:=1 To MAX_NUM_OF_G_I_PAGES Do { # of general input pages }
For Row:=1 To G_I_RECORD_LIMIT Do { # of general input rows }
If G_I_Data[Row,Page]<>Nil Then { check for corresponding prompt entry in template }
If Not ((Page=1) And (Row<=2)) Then { specific to example application of the input pre-processor }
WriteLn(InputDataFile,G_I_Data[Row,Page]^); { write entry out to file }
For Page:=1 To MAX_NUM_OF_S_I_PAGES Do { # of scrolling input pages }
For Row:=1 To S_I_ENTRY_LIMIT Do { # of scrolling input rows }
For Col:=1 To MAX_NUM_OF_S_I_DATA_COLS Do { # of scrolling input columns }
WriteLn(InputDataFile,S_I_Data[Col,Row,Page]^); { write entry out to file }
Close(InputDataFile); { close input data file }
End; { WriteInputDataFile }
Procedure ShowWriteFileMessage;
{ This procedure communicates to the user that the disk file is being
overwritten by the new input data. }
Begin { ShowWriteFileMessage }
SoundAttention;
TextColor(HighlightColor);
GotoXY(24,6);
Write('Input data file being written');
WriteInputDataFile;
ReturnToMainModule:=True; { exit back to main module }
End; { ShowWriteFileMessage }
Procedure PromptUserIfToWriteOverExistantFile;
{ This procedure prompts the user if he wants to write over the named
existant disk file with the new input data.
If the user answers yes then this module writes out the file and returns
him to the first menu page.
If the user answers no then this module prompts the user to see if he
wants to exit the pre-processor. If the user answers yes then he is
returned to the first menu page. If he answers no then the user is
returned to where he was left off. }
Begin { PromptUserIfToWriteOverExistantFile }
SoundAttention;
GotoXY(15,6);
Write('Do you wish that the existing disk file be overwritten?');
PromptUserModule(ToggleSwitchOn);
GotoXY(15,6);
Write(' ');
GotoXY(37,8);
Write(' ');
If ToggleSwitchOn Then { write over existing disk file }
ShowWriteFileMessage
Else { do not write over existing disk file }
Begin { check if user wants to exit the pre-processor without saving data }
SoundAttention;
GotoXY(11,6);
Write('Do you wish to exit input data processor without saving data?');
PromptUserModule(ToggleSwitchOn);
If ToggleSwitchOn Then
ReturnToMainModule:=True { exit back to main module }
Else { return to where user left off }
RemoveWindow;
End; { Else }
End; { PromptUserIfToWriteOverExistantFile }
Procedure PromptUserIfToExitPreprocessor;
{ This procedure prompts the user to see if he wants to exit the input data
preprocessor without saving data since there is no user declared input
filename.
If the user answers yes then he is returned to the first menu. If he
answers no then the user is returned to where he was left off. }
Var
TextString:WorkString; { a string used in passing text to other procedures }
Begin { PromptUserIfToExitPreprocessor }
StoreTextScreen(1); { take snapshot of the screen }
SoundAttention;
TextColor(InputWindowBorderColor);
TextBackground(InputWindowColor);
ZoomWindow2(4,4,77,10);
TextColor(ForegroundColor);
TextString:='Make selection with '+Chr(27)+' '+Chr(26)+' and then press <Enter>';
WriteCenterText(10,TextString);
TextColor(HighlightColor);
GotoXY(11,6);
Write('Do you wish to exit input data processor without saving data?');
PromptUserModule(ToggleSwitchOn);
If ToggleSwitchOn Then
ReturnToMainModule:=True { exit back to main module }
Else { return to where user left off }
RemoveWindow;
End; { PromptUserIfToExitPreprocessor }
Begin { WriteInputFileModule }
{ following routine is specific to example application of the input pre-processor }
If G_I_Data[1,1]^<>'' Then
Begin { user has entered a input file name }
ShowFileWindowModule;
TextColor(HighlightColor);
If ExistantFile Then
PromptUserIfToWriteOverExistantFile { prompt user if he wants to save input data to file }
Else { user declared input file is non-existant, write input data file }
ShowWriteFileMessage;
End { If G_I_Data }
Else { no input file name has yet been entered by user }
PromptUserIfToExitPreprocessor;
End; { WriteInputFileModule }
Procedure DirectoryModule;
{ *************************************************************************** }
{ * * }
{ * DIRECTORY MODULE * }
{ * * }
{ * This module controls the display of the disk directory window. * }
{ * This module will only list those files with the three character * }
{ * extension defined for the input data files allowed for this * }
{ * particular application of the pre-processor. Note that the * }
{ * three character input data file extension is declared in the * }
{ * constant header in the file 'Main.Mod'. * }
{ * * }
{ * This method was selected since the user only needs to see those * }
{ * files that are input data files specific to the particular * }
{ * application of the pre-processor. * }
{ * * }
{ * Note that an interesting project might be re-writing this module * }
{ * to show the subdirectories in one color and the input data files * }
{ * in a different color, just like the Turbo editor does. * }
{ * * }
{ *************************************************************************** }
Var
LoggedDirectory:WorkString; { a string used to temporarily store the currently logged directory }
ExistantDirectory:Boolean; { a boolean used in checking if specified directory is existant }
Procedure ListDirectory;
{ This procedure lists out all the valid input data files with the declared
input data file extension constant in the directory window. }
Type { ListDirectory }
CharArray=Array [1..12] Of Char; { array type of character used in looking for input data files }
WorkString=String[20]; { string type used for file names }
RecordOfRegisters= { a record type to store the integer values of the 8088 internal registers }
Record
AX, BX, CX, DX, BP, SI, DI, DS, ES, Flags : Integer; { Registers }
End; { RecordOfRegisters }
Var
Registers:RecordOfRegisters; { record variable used to store the integer values of the 8088 internal registers }
DTA:Array [ 1..43 ] Of Byte; { Data Transfer Area }
Mask:CharArray; { an array used to store the input file name mask }
FileName:WorkString; { a variable used to store a filename found in the directory }
Error:Integer; { a variable used to store the returned error code }
I:Integer; { an index counter used in returning file names }
J:Integer; { an index counter used in placing spaces between the acquired file names }
Begin
FillChar(DTA,SizeOf(DTA),0); { initialize the DTA buffer }
FillChar(Mask,SizeOf(Mask),0); { initialize the mask }
FillChar(FileName,SizeOf(FileName),0); { initialize the file name }
Registers.AX:=$1A00; { function used to set the DTA }
Registers.DS:=Seg(DTA); { store the parameter segment in the data egment register DS }
Registers.DX:=Ofs(DTA); { stare the parameter offset in the data register DX }
MSDos(Registers); { set DTA location }
Error:=0; { initialize error flag }
Mask:='????????.???'; { use for search of input data files }
Mask[9]:=INPUT_FILE_NAME_EXTENSION[1]; { used for looking for input files with a particular file name extension }
Mask[10]:=INPUT_FILE_NAME_EXTENSION[2];
Mask[11]:=INPUT_FILE_NAME_EXTENSION[3];
Mask[12]:=INPUT_FILE_NAME_EXTENSION[4];
Registers.AX:=$4E00; { get first directory entry }
Registers.DS:=Seg(Mask); { point to the file Mask }
Registers.DX:=Ofs(Mask);
Registers.CX:=22; { store the option }
MSDos(Registers); { execute MSDos call }
Error:=Registers.AX and $FF; { get Error return }
I:=1; { initialize 'I' to the first element }
If (Error=0) Then
Repeat
FileName[I]:=Chr(Mem[Seg(DTA):Ofs(DTA)+29+I]);
I:=I+1;
Until Not (FileName[I-1] in [' '..'~']) or (I>20);
FileName[0] := Chr(I-1); { set string length because assigning by element does not set length }
If (Error=0) Then
Begin { remove data file name extension }
Delete(FileName,Length(FileName)-4,4);
Write(FileName);
For J:=Length(FileName)+1 To 10 Do { place spaces between file names so that they line up vertically }
Write(' ');
End; { If Error }
While (Error=0) Do
Begin
Error:=0; { initialize error flag }
Registers.AX:=$4F00; { function used to get the next directory entry }
Registers.CX:=22; { set the file option }
MSDos(Registers); { call MSDos }
Error:=Registers.AX and $FF; { get the Error return }
I:=1;
Repeat
FileName[I]:=Chr(Mem[Seg(DTA):Ofs(DTA)+29+I]);
I:=I+1;
Until Not (FileName[I-1] in [' '..'~'] ) or (I > 20);
FileName[0]:=Chr(I-1);
If (Error=0) Then
Begin { remove data file name extension }
Delete(FileName,Length(FileName)-4,4);
Write(FileName);
For J:=Length(FileName)+1 To 10 Do { place spaces between file names so that they line up vertically }
Write(' ');
End; { If Error }
End; { While Error }
End; { ListDirectory }
Procedure ShowDirectoryWindow( ExistantDirectory:Boolean);
{ This procedure overlays a directory window to list out input data files on
top of the current page if the passed ExistantDirectory is true, else it
displays an error message and removes the incorrectly entered directory
path. }
Var
TextString:WorkString; { string variable used in getting the currently logged directory }
Begin { ShowDirectoryWindow }
StoreTextScreen(1); { take snapshot of the screen }
If ExistantDirectory Then
Begin { place directory window on top of current page }
TextColor(InputWindowBorderColor);
TextBackground(InputWindowColor);
SoundAttention;
ZoomWindow2(4,17,77,24);
TextColor(HighlightColor);
GetDir(0,TextString); { get directory label containing input data files }
WriteCenterText(17,'Directory Listing of '+TextString);
TextColor(ForegroundColor);
WriteCenterText(24,'Strike any key to continue');
Window(12,18,71,23);
GotoXY(1,1);
TextColor(HighlightColor);
ListDirectory;
Window(1,1,80,25);
End { If ExistantDirectory }
Else { tell user that directory path specified is non-existent }
Begin
TextColor(ForegroundColor);
TextBackground(BackgroundColor);
SoundAttention;
ZoomWindow1(4,5,77,7);
TextColor(HighlightColor);
WriteCenterText(6,'The above specified directory path is non-existant');
TextColor(ForegroundColor);
WriteCenterText(7,'Strike any key to continue');
{ following routine is specific to example application of the input pre-processor }
G_I_Data[2,1]^:=''; { delete wrongly entered directory path }
End; { Not a existent directory }
End; { ShowDirectoryWindow }
Begin { DirectoryModule }
ExistantDirectory:=True; { initialize boolean flag }
GetDir(0,LoggedDirectory); { temporarily store the currently logged directory }
{ following routine is specific to the example application of the input pre-processor }
If G_I_Data[2,1]^<>'' Then { check if user has specified a directory path }
Begin
{$I-} { I/O error checking is set to passive state }
ChDir(G_I_Data[2,1]^); { attempt to change directories }
{$I+} { I/O error checking is set to active state }
ExistantDirectory:=(IOresult=0); { If ExistantDirectory=True, then directory exists }
End; { If G_I_Data }
ShowDirectoryWindow(ExistantDirectory);
If Not ExistantDirectory Then
Write_G_I_Entries; { this removes the wrongly entered directory path }
ChDir(LoggedDirectory); { change back to the previously logged directory }
WaitUntilKeypressed;
RemoveWindow;
End; { DirectoryModule }